home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine CD 1995
/
Archive Magazine CD 1995.iso
/
discs
/
prog_disc
/
volume_1
/
issue_08
/
musiced
(
.txt
)
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
RISC OS BBC BASIC V Source
|
1988-04-25
|
70.2 KB
|
2,968 lines
> &.MusicEd
(c) Acorn Computers 1987
Version 1.01
error:
INITIALISED%=
initialise
error
PLAYING% B1%=B2%:
Sound_QBeat
B2%:
B2%<B1%
play_bar
wimp_attended
pointer_attended
EXIT%
wimp_attended
terminate
SKS IFLENHost$ SYS OS_FSControl,0,Host_Dir$:CHAINHost$
("DIR &"):
*DeskTop
wimp_attended
A%=%100000
Poll_Wimp,A%,Window+handle
redraw_window_request
open_window_request
close_window_request
pointer_leaving_window
mouse_button_click
key_pressed
pointer_attended
>PTIME%
PTIME%=
@"Imminent_KEY%+=Imminent_KEY%>0
highlight_pointer
SCORING%
symbol_pointer
redraw_window_request
Redraw_Window,,Window+handle
Window!handle
Description_W%:
draw_description
Score_W%:
draw_staves
Confirm_W%:
draw_confirmation
Get_Rectangle,,Window+handle
open_window_request
release
Open_Window,,Window+handle
close_window_request
W%,O%
release
Window!handle
Description_W%:O%=
MH_Describe(O_Exit%)
Score_W%:
close_window(Window!handle)
X%O%=
match_option(7,Window!handle)
OO%=O%:O$=O$(O%)
do_option(O_Exit%)
match_menu(1,Window!handle)
close_menu(O%)
open_window(W%,U%)
Window!handle=W%
Get_Window_State,,Window+handle
Window!under=U%
Open_Window,,Window+handle
move_window(W%,X%,Y%,U%)
x%,y%
Window!handle=W%
Get_Window_State,,Window+handle
#x%=X%-Window!x0:y%=Y%-Window!y1
Window!x0+=x%:Window!x1+=x%
Window!y0+=y%:Window!y1+=y%
Window!under=U%
Open_Window,,Window+handle
check_window(W%,U%)
Window!handle=W%
Get_Window_State,,Window+handle
Window?status
Window!under=U%:
Open_Window,,Window+handle
close_window(W%)
Window!handle=W%
Close_Window,,Window+handle
pointer_leaving_window
Window!handle=Confirm_W%
confirm(
mouse_button_click
B%,C%,W%,I%
!W%=Mouse!window:I%=Mouse!icon
6B%=%111
Mouse!buttons:C%=B%
Mouse!old_buttons
'Mouse_X%=Mouse!x0:Mouse_Y%=Mouse!y0
B%=%010
C%=%010
W%=Confirm_W%
confirm(
open_menu(Menu_Root%+1,
Score_W%
B%=%100
C%=%100
SCORING%
SCRIBE%(drawn%)
put_down
B%=%001
C%=%001
play(
release:SCORING%=
Confirm_W%:
confirm(
Description_W%
%101
release
match_option(7,W%)
B%=Adj%
%1)>0
ZOO%=O%:O$=O$(O%):
I%>=0
select_item(B%
set_option(O%(OO%,Menu%),O%(OO%,Option%))
match_menu(1,W%)
O% MO%=O%:
I%>=0
select_option(I%+1)
keyboard
key_pressed
*FX21,0
PLAYING%
Window!key=27
play(
!Icon
input_key(Window!handle,!Icon,Window!key)
Window!handle
Menu_W%(M%(MO%)):
menu_key(Window!key)
List_W%(O%(OO%,List%)):
list_key(Window!key)
Confirm_W%:
confirm_key(Window!key)
keyboard
CONFIRM%>0 W%=Confirm_W%
OO% W%=List_W%(O%(OO%,List%))
MO% W%=Menu_W%(M%(MO%))
Set_Caret_Position,W%,
,,,&2000000
keyoff
Set_Caret_Position,
highlight(W%,I%,S%)
Window!handle=W%:!Icon=I%
S% Icon!state=C_High<<28
Get_Icon_Info,,Icon+handle:Icon!state=5-(Icon?23
&F)<<27
Icon!mask=&F0000000
Set_Icon_State,,Icon+handle
select(W%,I%,S%)
Window!handle=W%:!Icon=I%
Icon!state=S%<>
&200000
Icon!mask=&200000
Set_Icon_State,,Icon+handle
outline(W%,I%,S%)
Window!handle=W%:!Icon=I%
Icon!state=S%<>
Icon!mask=%100
Set_Icon_State,,Icon+handle
input_key(W%,I%,K%)
match_option(7,W%)
O$=O$(OO%)
do_option(O_Exit%)
do_option(I%)
138,139:
do_option(I%):
list_key(K%)
menu_key(K%)
Imminent_KEY%=
Get_Pointer_Info,,Mouse
Mouse!buttons
close_menu(MO%)
Menu_OPTION%(0) MO%=
match_menu(0,Menu_OPTION%(0)):
select_option(Menu_OPTION%(1))
key_option(K%)
match_option(6,K%)
OO%=L%
O$=O$(OO%)
set_option(O%(OO%,Menu%),O%(OO%,Option%))
open_window(List_W%(O%(OO%,List%)),-1)
keyboard
highlight_option(K%)
describe(0,K%)
Imminent_KEY%=15
list_key(K%)
Imminent_KEY%>0
Imminent_KEY%=
menu_key(K%)
S%,L%,I%,V%
release
do_option(O_Exit%)
O%(OO%,Item%)>=0
select_item(O%(OO%,Item%)
SCORING%)
136,137,138,139
p%L%=O%(OO%,List%):I%=O%(OO%,Item%)
K%>137 K%=
(138.5-K%)
(K%-136.5)*(List_Items%(L%)
List_Columns%(L%)+1)
I%>=0 S%=SCORING%
O%(OO%,State%)<>0
List_Flag%(L%,I%)
S% I%=
bit(O%(OO%,State%))
I%+=K%
V%=I%>=0
I%<=List_Items%(L%)
List_Select%(L%)
%1<<I%
outline_item(I%):
describe(1,I%):List_KEY%=
do_option(I%)
K%>48
K%<58
I%=(K%
&F)-1
I%>=0
I%<=List_Items%(O%(OO%,List%))
describe(1,I%):
select_item(I%):List_KEY%=
menu_key(K%)
describe(S%,N%)
S%=0 O%=M%(MO%)
O%=O%(OO%,List%)
O%>0
O%<>DESCRIPTION%(0)
N%<>DESCRIPTION%(2) DESCRIPTION%(0)=O%:DESCRIPTION%(1)=S%:DESCRIPTION%(2)=N%:
new_description
new_description
DESCRIBING%
R%,C%
~ Window!handle=Description_W%
OWindow!x0=0:Window!y0=-C_Height%-Vi%*2:Window!x1=S_Width%-Hi%*2:Window!y1=0
Update_Window,,Window+handle
&DL%=(Window!x1-Window!x0)/C_Width%
draw_description
Get_Rectangle,,Window+handle
draw_description
DN$,D$
O%=DESCRIPTION%(2)
DESCRIPTION%(1)
O% O%=
option_n(DESCRIPTION%(0),O%)+1
menu_name(DESCRIPTION%(0))-1
menu_OPTION(O%+1)+": "
?O% D$=Menu_Description$(?O%)
List_Flag%(DESCRIPTION%(0),O%)
(List_Flag%(DESCRIPTION%(0),O%)
&F000)=&F000
DN$=List_Item$(DESCRIPTION%(0),O%)+": "
Z,D$=List_Description$(DESCRIPTION%(0),O%)
print(Window!x0-Window!scx,Window!y1-C_Height%-2*Vi%," "+DN$+D$,DL%)
open_menu(M%,P%)
match_menu(0,M%)
MOP%+=1:M%(MOP%)=M%:MO%=MOP%
Window!handle=Menu_W%(M%)
Get_Window_State,,Window+handle
'T%=Mouse_X%-(Window!x0+Window!x1)
Window!x0+=T%:Window!x1+=T%
T%=Mouse_Y%-Window!y1
Window!y0+=T%:Window!y1+=T%
Window!under=-1
Open_Window,,Window+handle
Menu_BASE%(M%)>0 P%=
match_option(6,Menu_BASE%(M%)):
P% OO%=P%:O$=O$(OO%)
keyboard
close_menu(H%)
keyoff
M%:M%=M%(H%)
close_window(Menu_W%(M%(H%)))
M%(H%)=M%(MOP%)
MOP%-=1
MO%>MOP% MO%=MOP%
Menu_BASE%(M%(MO%))>0 M%=
match_option(6,Menu_BASE%(M%(MO%))):
M% OO%=M%:O$=O$(OO%)
keyboard
match_menu(T%,V%)
H%=MOP%
Menu_W%(M%(H%))<>V%
H%:H%+=
M%(H%)<>V%
H%:H%+=
select_option(O%)
P%,o%
Imminent_KEY%=
option_n(M%(MO%),O%)
?P%=0
set_option(M%(MO%),O%)
match_option(6,O%)
OO% O$=O$(OO%):
open_window(List_W%(O%(OO%,List%)),-1)
name_option(M%(MO%),P%+2):CONFIRM%=
do_option(O_Entry%)
keyboard
& OO%=0
open_menu(?P%,
option_n(M%,N%)
P%=MP%(M%)
N%>0
N%=N%
-1:P%+=
$P%,Sep$):
set_option(M%,O%)
Menu_BASE%(M%)<>O%
U%=Menu_BASE%(M%)
select(Menu_W%(M%),O%-1,
select(Menu_W%(M%),U%-1,
Menu_BASE%(M%)=O%
key_option(C%)
alphanumeric(C%)
C%<0
P%,I%
F%,O%
P%=MP%(M%(MO%)):I%=2
* O%+=1
P%+=I%
$P%,Sep$,3)
C%,3)
P%?I%=13
F%<I%
F%<I%
name_option(M%,P%)
I%,N$
N$="_"+
menu_option(P%)
$I%=?
menu_name(M%):
I%>96 I%-=32
I%+N$
M%=?MP%(M%)
M%=Menu_Root%
="FN"+N$+"(R%)"
do_option(R%)
play(
PLAYING%)
highlight_option(O%)
M%(MO%)<>Menu_OPTION%(0)
O%<>Menu_OPTION%(1)
Menu_OPTION%(0)
highlight(Menu_W%(Menu_OPTION%(0)),Menu_OPTION%(1)-1,
O%>0 Menu_OPTION%(0)=M%(MO%):Menu_OPTION%(1)=O%:
highlight(Menu_W%(Menu_OPTION%(0)),O%-1,
):List_KEY%=
Menu_OPTION%(0)=0
select_item(I%)
i%:i%=I%
Adj%+
List_Select%(O%(OO%,List%))
%1<<i%
outline_item(i%):
do_option(I%)
open_option(L%)
assert(OOP%<Max_Option%,"Available space in options open table")
OOP%+=1
OO%=OOP%
O%(OO%,Menu%)=M%(MO%)
t'O%(OO%,Option%)=Menu_BASE%(M%(MO%))
O%(OO%,Item%)=
O%(OO%,List%)=L%
O%(OO%,State%)=
O$(OO%)=O$
Y%,T%
"Window!handle=Menu_W%(M%(MO%))
Get_Window_State,,Window+handle
Y%=Window!y0-B_Height%+Vi%
Window!handle=List_W%(L%)
Get_Window_State,,Window+handle
'T%=Mouse_X%-(Window!x0+Window!x1)
Window!x0+=T%:Window!x1+=T%
T%=Y%-Window!y1
Window!y0+=T%:Window!y1+=T%
Window!under=-1
Open_Window,,Window+handle
list_set(List_STATE%(L%),
outline_item(
bit(List_Select%(L%)))
close_option
keyoff
L%,I%,M%
L%=O%(OO%,List%)
close_window(List_W%(L%))
outline_item(
M%=O%(OO%,Menu%)
Menu_BASE%(M%)=O%(OO%,Option%)
set_option(M%,0)
"List_STATE%(L%)=O%(OO%,State%)
I%=0
4:O%(OO%,I%)=O%(OOP%,I%):
O$(OO%)=O$(OOP%):OOP%-=1
Menu_BASE%(M%)>0
M%=M%(MO%) OO%=
match_option(6,Menu_BASE%(M%))
match_option(Menu%,M%)
O$=O$(OO%)
set_option(M%,O%(OO%,Option%))
keyboard
match_option(T%,V%)
O%=OOP%
Menu_W%(O%(O%,Menu%))<>V%
O%:O%+=
(O%(O%,Menu%)<>M%(MO%)
O%(O%,Option%)<>V%)
O%:O%+=
List_W%(O%(O%,List%))<>V%
O%:O%+=
O%(O%,T%)<>V%
O%:O%+=
list_set(S%,M%,N%)
(O%(OO%,State%)
S%)=S% S%=O%(OO%,State%)
S%=O%(OO%,State%)
C%=(O%(OO%,State%)
C% O%(OO%,State%)=
set_list(O%(OO%,List%),C%,S%)
list_reset(L%,S%)
match_option(List%,L%)
O% O%(O%,State%)=
set_list(L%,O%(O%,State%)
S%,S%)
List_STATE%(L%)=
set_list(L%,List_STATE%(L%)
S%,S%)
set_list(L%,C%,S%)
(%1<<B%-
)<=C%
%1<<B%
highlight(List_W%(L%),B%,S%
%1<<B%)
outline_item(I%)
I%<>O%(OO%,Item%)
O%(OO%,Item%)>=0
outline(List_W%(O%(OO%,List%)),O%(OO%,Item%),
I%>=0 O%(OO%,Item%)=I%:
outline(List_W%(O%(OO%,List%)),I%,
O%(OO%,Item%)=-1
confirm(C%)
CONFIRM%=C%
1,2,3
Get_Pointer_Info,,Mouse
l'Mouse_X%=Mouse!x0:Mouse_Y%=Mouse!y0
Window!handle=Confirm_W%
CWindow!x0=Mouse_X%-4.5*C_Width%:Window!x1=Mouse_X%+4.5*C_Width%
AWindow!y0=Mouse_Y%-2*C_Height%:Window!y1=Mouse_Y%+2*C_Height%
-Window!scx=0:Window!scy=0:Window!under=-1
Open_Window,,Window+handle
close_window(Confirm_W%)
do_option(O_Exit%)
close_window(Confirm_W%)
do_option(O_Entry%)
keyboard
draw_confirmation
4,Window!x0+C_Width%
2,Window!y1-5*Vi%
CONFIRM%
"Abandon"
BYC_Width%
"current"
BYC_Width%
"score?"
"Replace"
BYC_Width%
"existing"
BYC_Width%
"file?"
" Are"
BYC_Width%
" you"
BYC_Width%
" sure?"
confirm_key(K%)
Imminent_KEY%=
confirm(
confirm(
highlight_pointer
W%,I%,O%
Get_Pointer_Info,,Mouse
!W%=Mouse!window:I%=Mouse!icon
match_menu(1,W%)
MO%:MO%=O%
I%>=0 I%+=1:
highlight_option(I%):
List_KEY%
describe(0,I%)
match_option(7,W%)
OO%:OO%=O%
I%>=0
List_Select%(O%(OO%,List%))
%1<<I%
outline_item(I%):
describe(1,I%):List_KEY%=
Imminent_KEY%
highlight_option(-1)
Imminent_KEY%
highlight_option(-1):
List_KEY%
describe(0,Menu_BASE%(M%(MO%)))
CONFIRM%>0
W%<>Confirm_W%
confirm(
symbol_pointer
Get_Pointer_Info,,Mouse
Mouse!window=Score_W%
Mouse!buttons=
scribe(Mouse!x0,Mouse!y0)
M_eXit(R%)
O_Entry%
CONFIRM%=
CHANGED%=
EXIT%=
set_option(M%(MO%),0)
confirm(1)
O_Exit%:
set_option(M%(MO%),0)
MH_Describe(R%)
O_Entry%
open_window(Description_W%,-1)
DESCRIBING%=
set_option(M%(MO%),0)
O_Exit%
close_window(Description_W%)
DESCRIBING%=
O_Initialise%
define_window(0,0,S_Width%-Hi%*2,C_Height%+Vi%*2,&B,
,"DESCRIBE",C_Text,C_Menu,C_Music,C_Bkgd)
Create_Window,,Window
Description_W%
DESCRIBING%=
&DL%=(Window!x1-Window!x0)
C_Width%
MS_Clear(R%)
O_Entry%
CONFIRM%=
CHANGED%=
GATE%=MUSIC%+2
FINE%()=MUSIC%()
PP%=MUSIC%:P%()=MUSIC%()
start_music
rescore(0)
CHANGED%=
set_option(M%(MO%),0)
confirm(1)
O_Exit%:
set_option(M%(MO%),0)
MS_Volume(R%)
R%>=0
R%=R%
list_set(%1<<R%,&7FFF,&7FFF)
Volume%=R%
Sound_Volume,Volume%(Volume%)
O_Entry%:
open_option(Volume_list%)
O_Exit%:
close_option
O_Initialise%
NVolumes%=8
Volume%(NVolumes%),Volumes%(7)
NVolumes%
:*Volume%(R%)=(R%+1)*128/(NVolumes%+1)-1
N)Volume_list%=
define_list("VOLUME",1)
list_item("Pianississimo:As softly as possible ("+
Volume%(0)+")",&3131)
list_item("Pianissimo:Very Softly ("+
Volume%(1)+")",&3031)
list_item("Piano:Softly ("+
Volume%(2)+")",&3031)
list_item("Mezzo-Piano:Moderately softly ("+
Volume%(3)+")",&3031)
list_item("Mezzo:Medium ("+
Volume%(4)+")",&3031)
list_item("Mezzo-Forte:Moderately loud ("+
Volume%(5)+")",&3031)
list_item("Forte:Loudly ("+
Volume%(6)+")",&3031)
list_item("Fortissimo:Very loudly ("+
Volume%(7)+")",&3031)
list_item("Fortississimo:As loudly as possible ("+
Volume%(8)+")",&3131)
end_list(Volume_list%)
Sound_Volume
8Volume%=R%*(NVolumes%+1)/128-.5:
Volume%<0 Volume%=0
)List_STATE%(Volume_list%)=%1<<Volume%
Sound_Volume,Volume%(Volume%)
7:Volumes%(R%)=NVolumes%:
MS_Stave(R%)
R%>=Adj% R%-=Adj%
R%>=0 CHANGED%=
list_set(%001,%101,%111):
new_staves
list_set(%010,%110,%111):
new_staves
list_set(%100,%111,%111):
new_staves
list_set(%010000,%110000,0):
new_staves
list_set(%100000,%110000,0):
new_staves
O_Entry%
check_window(Score_W%,-2)
open_option(Stave_list%)
O_Exit%:
close_option
O_Initialise%
Max_Stave%=3
Li%=2*Vi%
Stave_Height%=Li%*8
Y_STAVE%(Max_Stave%+2)
STAVE%=0
PERC%=0
'Stave_list%=
define_list("STAVE",1)
list_item("VOICE:One stave (may be an accompaniment to Keyboard)",&3031)
list_item("KEYBOARD:Two staves (may be accompanied by Voice)",&3031)
list_item("CHORUS:Four staves",&3031)
list_item("",0)
list_item("SINGLE:One percussion line",&3031)
list_item("DOUBLE:Two percussion lines",&3031)
end_list(Stave_list%)
$0List_STATE%(Stave_list%)=PERC%<<4
STAVE%+1
.&Score_Width%=S_Width%-B_Width%-Hi%
position_staves
define_window(Hi%,S_Height%-B_Height%+Vi%,Score_Width%,Score_Height%,&F,
,"The Score",C_Text,C_Menu,C_Stav,C_Bkgd)
Create_Window,,Window
Score_W%
setup_staves
new_staves
S%,P%
S%=(O%(OO%,State%)
P%=O%(OO%,State%)>>4
S%<>STAVE%
P%<>PERC% STAVE%=S%:PERC%=P%:
setup_score
setup_score
S%,P%
setup_staves
7:S_C%(S%)=Stave_Channels%(STAVE%,S%):
?P%=0:
P%<PERC%:P%+=1:S_C%(7-(2-P%)*(5-STAVE%))=STAVE%+P%:
/Instrument%(S%,1)=S_C%(Instrument%(S%,0))+1
sort_instruments
P%=0:
P%,DESCRIBING%
update_item(Instrument_list%,S%,Nth$(Instrument%(S%,1)+(STAVE%-3)*(Instrument%(S%,1)-1>STAVE%))+";")
(HList_Description$(Instrument_list%,S%
8)=Voice$(Instrument%(S%,2),1)
update_item(Instrument_list%,S%
8,Voice$(Instrument%(S%,2),0))
<iList_Description$(Instrument_list%,S%
16)=List_Description$(Volume_list%,Volumes%(Instrument%(S%,0)))
update_item(Instrument_list%,S%
16,List_Item$(Volume_list%,Volumes%(Instrument%(S%,0))))
P\List_Description$(Instrument_list%,S%
24)=Stereo$(Stereo_Position%(Instrument%(S%,0)),1)
update_item(Instrument_list%,S%
24,Stereo$(Stereo_Position%(Instrument%(S%,0)),0))
P%,DESCRIBING%
new_description
MS_Instrument(R%)
r%,S%
S%=-1
R%>=Adj% R%-=Adj%:S%=1
R%>=0 CHANGED%=
:r%=R%
8:R%=R%
BInstrument%(r%,2)=(Instrument%(r%,2)+S%+NVoices%-1)
NVoices%+1
Sound_AttachVoice,r%+1,Instrument%(r%,2)
HList_Description$(Instrument_list%,r%
8)=Voice$(Instrument%(r%,2),1)
update_item(Instrument_list%,r%
8,Voice$(Instrument%(r%,2),0))
R%=Instrument%(r%,0)
<Volumes%(R%)=(Volumes%(R%)+S%+NVolumes%+1)
(NVolumes%+1)
ZList_Description$(Instrument_list%,r%
16)=List_Description$(Volume_list%,Volumes%(R%))
update_item(Instrument_list%,r%
16,List_Item$(Volume_list%,Volumes%(R%)))
R%=Instrument%(r%,0)
@LStereo_Position%(R%)=(Stereo_Position%(R%)+S%+NStereos%+1)
(NStereos%+1)
Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
TMList_Description$(Instrument_list%,r%
24)=Stereo$(Stereo_Position%(R%),1)
update_item(Instrument_list%,r%
24,Stereo$(Stereo_Position%(R%),0))
O_Entry%:
open_option(Instrument_list%)
O_Exit%:
close_option
O_Initialise%
Stave_Channels%(Max_Stave%+2,7)
S%=0
Max_Stave%
R%=0
&Stave_Channels%(S%,R%)=(S%+1)*R%
Stave_Channels%(2,1)=1
Stave_Channels%(2,2)=1
Stave_Channels%(2,5)=2
S_C%(7)
'S_C%(R%)=Stave_Channels%(STAVE%,R%)
I$,L%,M%
Sound_InstallVoice
I$,NVoices%:NVoices%-=1
Voice$(NVoices%,1)
Instrument%(7,2)
Nth$(6)
DyNth$(1)="1st stave":Nth$(2)="2nd stave":Nth$(3)="3rd stave":Nth$(4)="4th stave":Nth$(5)="1st perc":Nth$(6)="2nd perc"
NVoices%
Sound_InstallVoice,0,R%
Voice$(R%,1)
NVoices%
Voice$(R%,1)+" "," ")-1
L%>M% M%=L%
NVoices%-1
L%=R%+1
NVoices%
cut(Voice$(L%,1),M%)=
cut(Voice$(R%,1),M%)
M%<30
M%+=1
NVoices%
4Voice$(R%,0)=
cut(Voice$(R%,1),M%)+
M%," "),M%)
Sound_AttachVoice,R%+1,0
L%,S%:
S%>NVoices% S%=1
Sound_AttachVoice,L%,S%
Instrument%(R%,0)=R%
* Instrument%(R%,1)=S_C%(R%)+1
Instrument%(R%,2)=S%
sort_instruments
R1Instrument_list%=
define_list("INSTRUMENT",4)
f2S%=Instrument%(R%,1):
S%-1>STAVE% S%+=3-STAVE%
list_item(Nth$(S%)+"; ",&371)
S%=Instrument%(R%,2)
list_item(Voice$(S%,0)+":"+Voice$(S%,1),&3131)
list_item(List_Item$(Volume_list%,Volumes%(Instrument%(R%,0)))+":"+List_Description$(Volume_list%,Volumes%(Instrument%(R%,0))),&3131)
NStereos%=6
Stereo%(NStereos%),Stereo$(NStereos%,1),Stereo_Position%(7)
Stereo$(0,0)="Full left":Stereo$(1,0)="Left":Stereo$(2,0)="Centre left":Stereo$(3,0)="Centre":Stereo$(4,0)="Centre right":Stereo$(5,0)="Right":Stereo$(6,0)="Full right"
NStereos%
&Stereo%(R%)=(2*R%/NStereos%-1)*127
6Stereo$(R%,1)="Stereo position ("+
Stereo%(R%)+")"
$Stereo_Position%(R%)=NStereos%
Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
list_item(Stereo$(Stereo_Position%(Instrument%(R%,0)),0)+" :"+Stereo$(Stereo_Position%(Instrument%(R%,0)),1),&3131)
end_list(Instrument_list%)
L#List_STATE%(Instrument_list%)=0
cut(C$,L%):
I%,S%
S%=I%:I%=
C$," ",S%+1):
I%-1>L%
C$,S%-1)
C$,L%)
sort_instruments
I%,J%,S%
J%=I%+1
Instrument%(J%,1)<=Instrument%(I%,1)
Instrument%(J%,1)<Instrument%(I%,1)
Instrument%(J%,0)<Instrument%(I%,0)
Instrument%(J%,S%),Instrument%(I%,S%):
MS_Tempo(R%)
R%>=0
R%=R%
list_set(%1<<R%,&7FFF,&7FFF)
set_tempo(R%)
CHANGED%=
O_Entry%:
open_option(Tempo_list%)
O_Exit%:
close_option
O_Initialise%
NTempos%=14
Tempo%(NTempos%)
x'Tempo_list%=
define_list("TEMPO",1)
RTempo%(0)=40:
list_item("Larghissimo:Very Slow (40 crotchets a minute)",&3031)
UTempo%(1)=50:
list_item("Largo:Slow and dignified (50 crotchets a minute)",&3031)
TTempo%(2)=60:
list_item("Larghetto:Rather slowly (60 crotchets a minute)",&3031)
]Tempo%(3)=65:
list_item("Grave:Slow, solemn and dignified (65 crotchets a minute)",&3031)
STempo%(4)=70:
list_item("Adagio:Slow, leisurely (70 crotchets a minute)",&3031)
MTempo%(5)=80:
list_item("Adagietto:Slowly (80 crotchets a minute)",&3031)
QTempo%(6)=90:
list_item("Andante:Walking pace (90 crotchets a minute)",&3031)
OTempo%(7)=100:
list_item("Andantino:Medium (100 crotchets a minute)",&3031)
RTempo%(8)=115:
list_item("Moderato:Moderately (115 crotchets a minute)",&3031)
YTempo%(9)=130:
list_item("Allegretto:Moderately fast (130 crotchets a minute)",&3031)
STempo%(10)=145:
list_item("Allegro:Fast, merry (145 crotchets a minute)",&3031)
STempo%(11)=160:
list_item("Vivace:Fast, lively (160 crotchets a minute)",&3031)
UTempo%(12)=175:
list_item("Veloce:Fast, speedily (175 crotchets a minute)",&3031)
PTempo%(13)=190:
list_item("Presto:Very fast (190 crotchets a minute)",&3031)
VTempo%(14)=210:
list_item("Prestissimo:Extra fast (210 crotchets a minute)",&3031)
end_list(Tempo_list%)
""List_STATE%(Tempo_list%)=%1<<8
set_tempo(8)
MT_Clef(R%)
0,1,2,3:
list_set(%1<<R%,%1111,%1111)
check_window(Score_W%,-2)
attach(clef%+R%,%100)
O_Entry%:
open_option(Clef_list%)
O_Exit%:
list_set(%10000,%1111,0):
close_option
O_Initialise%
%Clef_list%=
define_list("CLEF",2)
list_item("clef%:Treble clef",&303A)
list_item("clef%+1:Alto clef",&303A)
list_item("clef%+2:Tenor clef",&303A)
list_item("clef%+3:Bass clef",&303A)
end_list(Clef_list%)
List_STATE%(Clef_list%)=0
=R%<0
MT_Key(R%)
0,1:
check_window(Score_W%,-2)
attach(key%,%10)
FONT%
list_set(%11,%11,%11)
Adj%+0:KEY_SIG%(1)=(KEY_SIG%(1)+1)
update_item(Key_list%,0,
KEY_SIG%(1))
Adj%+1:KEY_SIG%(0)=
(KEY_SIG%(0)=0)
new_icon(List_W%(Key_list%),1,S$(accidental%+2+KEY_SIG%(0)))
O_Entry%:
open_option(Key_list%)
O_Exit%:
FONT%
list_set(%100,%111,0)
close_option
O_Initialise%
KEY_SIG%(1)
Key_Y%(3,1,6)
C%,A%,P%
C%=0
A%=0
P%=0
ZKey_Y%(C%,1-A%,P%)=3*(P%
%1)-P%
2+(P%-3)*A%+(A%
C%<>2
5)=0)*7-1-(C%-1>>1)-2*(C%=2)
#Key_list%=
define_list("KEY",2)
list_item("0:Number of accidentals (0-7)",&2171)
list_item("accidental%+2:Type of accidental (Sharp/Flat)",&303A)
end_list(Key_list%)
List_STATE%(Key_list%)=0
R%<0
KEY_SIG%(1) R%=accidental%+2+KEY_SIG%(0):X%(key%)=(x%(R%)+X%(R%))*KEY_SIG%(1):R%=
X%(key%)=x%(accidental%+2)+X%(accidental%+2)
!* =R%<0
MT_Time(R%)
check_window(Score_W%,-2)
attach(time%,%1)
FONT%
list_set(%11,%11,%11)
Adj%+0:TIME_SIG%(0)=(TIME_SIG%(0)+1)
update_item(Time_list%,0,
(TIME_SIG%(0)+1))
Adj%+1:TIME_SIG%(1)=(TIME_SIG%(1)-1)
update_item(Time_list%,1,
(1<<TIME_SIG%(1)-1))
O_Entry%:
open_option(Time_list%)
O_Exit%:
FONT%
list_set(%100,%111,0)
close_option
O_Initialise%
TIME_SIG%(1)
TIME_SIG%()=3
%Time_list%=
define_list("TIME",1)
list_item("4 :Beats per bar (1-16)",&2179)
list_item("4 :Beat type (2-Minim,4-Crotchet,8-Quaver,16-Semiquaver)",&2179)
end_list(Time_list%)
List_STATE%(Time_list%)=0
=R%<0
MT_Note(R%)
R%>=0
R%<Adj%
list_set(%1<<R%,&FFFF,&FFFF)
check_window(Score_W%,-2)
R%<8
attach(note%+R%,%111000)
attach(rest%+R%-8,%11000)
O_Entry%:
open_option(Note_list%)
O_Exit%:
list_set(&10000,&FFFF,0):
close_option
O_Initialise%
"~%Note_list%=
define_list("NOTE",4)
list_item("note%:Breve",&303A)
list_item("note%+1:Semibreve",&303A)
list_item("note%+2:Minim",&303A)
list_item("note%+3:Crotchet",&303A)
list_item("note%+4:Quaver",&303A)
list_item("note%+5:Semiquaver",&303A)
list_item("note%+6:Demi-semiquaver",&303A)
list_item("note%+7:Semi-demi-semiquaver",&303A)
list_item("rest%:Breve rest",&303A)
list_item("rest%+1:Semibreve rest",&303A)
list_item("rest%+2:Minim rest",&303A)
list_item("rest%+3:Crotchet rest",&303A)
list_item("rest%+4:Quaver rest",&303A)
list_item("rest%+5:Semiquaver rest",&303A)
list_item("rest%+6:Demi-semiquaver rest",&303A)
list_item("rest%+7:Semi-demi-semiquaver rest",&303A)
end_list(Note_list%)
List_STATE%(Note_list%)=0
#P =R%<0
MT_Other(R%)
R%>=0
R%<Adj%
check_window(Score_W%,-2):
list_set(%1<<R%,&3FFF,&3FFF)
0,1,2,5,6,9,10:
attach(accidental%+R%-R%
4*2+1,%1100000)
3,7,11:
attach(dot%+(R%+1)
4,%1101000)
attach(tie%,%1101000)
attach(bar%,%10010000)
O_Entry%:
open_option(Other_list%)
O_Exit%:
list_set(&4000,&3FFF,0):
close_option
O_Initialise%
'Other_list%=
define_list("OTHER",3)
list_item("accidental%+1:Natural",&303A)
list_item("accidental%+2:Sharp",&303A)
list_item("accidental%+3:Flat",&303A)
list_item("dot%+1:One dot",&303A)
list_item("tie%:Tie",&303A)
list_item("accidental%+4:Double sharp",&303A)
list_item("accidental%+5:Double flat",&303A)
list_item("dot%+2:Two dots",&303A)
list_item("bar%:Bar line",&303A)
list_item("accidental%+6:Natural sharp",&303A)
list_item("accidental%+7:Natural flat",&303A)
list_item("dot%+3:Three dots",&303A)
end_list(Other_list%)
List_STATE%(Other_list%)=0
$^ =R%<0
MC_Begin(R%)
O_Entry%
BP%>MUSIC%
release
start_music
rescore(0)
set_option(M%(MO%),0)
MC_Rewind(R%)
R%=O_Entry%
BP%>MUSIC%
release
start_bar
back_bar(1)
set_option(M%(MO%),0)
MC_Stop(R%)
O_Entry%
play(
release
GP%=PP%:N%()=P%()
back_bar(3)
set_option(M%(MO%),0)
play(P%)
PLAYING%
PLAYING%=
Sound_QInit
MC_Play(R%)
O_Entry%
release
SCORING%=
play_start
set_option(M%(MO%),0)
O_Initialise%
MC_Forward(R%)
O_Entry%
start_bar
R%=BBAR%+1
skip_gate:
BAR%>R%
GP%=GATE%
BAR%>R%
release
GP%-=2:BAR%=R%
set_bar
rescore(0)
set_option(M%(MO%),0)
MC_End(R%)
O_Entry%
release
GP%=GATE%:N%()=FINE%()
GP%?-1=Bar%
GP%?-2=
GP%-=2
back_bar(1)
set_option(M%(MO%),0)
MR_Catalogue(R%)
R%>0
R%=R%
list_set(%1<<R%,
FILENAME%=R%
Get_Caret_Position,,Window+handle
R%=!Icon<>
Set_Caret_Position,List_W%(Catalogue_list%),R%,,,
&2000000
FONT%
list_set(1,
list_set(1,
FILENAME%=0
O_Entry%:
open_option(Catalogue_list%)
O_Exit%:
close_option
O_Initialise%:
make_catalogue_list
"List_STATE%(Catalogue_list%)=0
FILENAME%=0
make_catalogue_list
F$,I%,M$,T%,L%,A%,F%
0Catalogue_list%=
define_list("CATALOGUE",-3)
list_item(" :Specified music file name",&F171)
get_name(0)
F%>=0
F$=$String_Space%
OS_File,5,F$
T%,,,,L%,A%
L%>8
FILE%=
(Z M$="":
7:M$+=
#FILE%:
M$="Maestro"
list_item(
F$,11)+":Of length "+
L%+" bytes",&3031)
#FILE%:FILE%=
get_name(F%)
end_list(Catalogue_list%)
get_name(N%)
S%:S%=String_Space%
"OS_GBPB",9,"",S%,1,N%,256,"*"
,,,,N%:
?S%:S%+=1:
:?S%=13:
filename:
FILENAME%>0
=List_Item$(Catalogue_list%,FILENAME%)
icon_text(List_W%(Catalogue_list%),0)
new_catalogue
S%,X%,Y%,U%,F$
icon_text(List_W%(Catalogue_list%),0)
*Window!handle=List_W%(Catalogue_list%)
Get_Window_State,,Window+handle
AS%=%1
Window?status:U%=Window!under:X%=Window!x0:Y%=Window!y1
redefine_list(Catalogue_list%)
make_catalogue_list
move_window(List_W%(Catalogue_list%),X%,Y%,U%)
)@>S%=
match_option(List%,Catalogue_list%):
S% O%(S%,Item%)=
FILENAME%
FONT%=
highlight(List_W%(Catalogue_list%),FILENAME%,
update_item(Catalogue_list%,0,F$)
MR_Load(R%)
O_Entry%
CONFIRM%=
CHANGED%=
load_music(
filename)
set_option(M%(MO%),0)
confirm(1)
O_Exit%:
set_option(M%(MO%),0)
load_music(F$)
T%,F%,L%,A%,M$
F%=FILENAME%
OS_File,5,F$
T%,,,,L%,A%:F%=(T%=1)
FILE%=
M$="":
7:M$+=
#FILE%:
#FILE%
M$="Maestro"
#FILE%
0:T%=
lTempo:
lInstruments:
lStaves:
lMusic
File id version 2 and above
#FILE%
lMusic,
lStaves,
lInstruments,
lVolumes,
lStereos,
lTempo
#FILE%
list_reset(Tempo_list%,%1<<Tempo%)
list_reset(Stave_list%,PERC%<<4
STAVE%+1)
setup_score
start_music
rescore(0)
CHANGED%=
#FILE%:FILE%=
lMusic
C%,B%
#FILE%,GATE%:GATE%+=MUSIC%
#FILE%,FINE%(C%):FINE%(C%)+=MUSIC%(C%)
+f,B%=MUSIC%:
B%<GATE%:?B%=
#FILE%:B%+=1:
+z4B%=MUSIC%(C%):
B%<FINE%(C%):?B%=
#FILE%:B%+=1:
PP%=MUSIC%:P%()=MUSIC%()
lStaves
STAVE%=
#FILE%
PERC%=
#FILE%
lInstruments
Instrument%(C%,0)=
#FILE%
,Instrument%(C%,2)=(
#FILE%-1)
NVoices%+1
Sound_AttachVoice,Instrument%(C%,0)+1,Instrument%(C%,2)
lVolumes
Volumes%(C%)=
#FILE%
lStereos
,t Stereo_Position%(C%)=
#FILE%
Sound_Stereo,C%+1,Stereo%(Stereo_Position%(C%))
lTempo
set_tempo(
#FILE%)
MR_Save(R%)
O_Entry%
F$,A%
filename
OS_File,5,F$
R%,,,,,A%:A%=R%=0
%1010)=%0010
CONFIRM%=
R%=0
save_music(F$)
set_option(M%(MO%),0)
new_catalogue
confirm(2)
set_option(M%(MO%),0)
O_Exit%:
set_option(M%(MO%),0)
save_music(F$)
FILE%=
#FILE%,"Maestro"
#FILE%,2
sMusic
sStaves
sInstruments
sVolumes
sStereos
sTempo
#FILE%:FILE%=
CHANGED%=
sMusic
C%,B%
#FILE%,1
#FILE%,GATE%-MUSIC%
#FILE%,FINE%(C%)-MUSIC%(C%)
.^,B%=MUSIC%:
B%<GATE%:
#FILE%,?B%:B%+=1:
.r4B%=MUSIC%(C%):
B%<FINE%(C%):
#FILE%,?B%:B%+=1:
sStaves
#FILE%,2
#FILE%,STAVE%
#FILE%,PERC%
sInstruments
#FILE%,3
#FILE%,Instrument%(C%,0)
#FILE%,Instrument%(C%,2)
sVolumes
#FILE%,4
#FILE%,Volumes%(C%)
sStereos
#FILE%,5
#FILE%,Stereo_Position%(C%)
sTempo
#FILE%,6
#FILE%,Tempo%
MR_Delete(R%)
O_Entry%
F$,A%
filename
OS_File,5,F$
R%,,,,,A%:A%=R%=1
%1000)=0
CONFIRM%=
OS_File,6,F$
set_option(M%(MO%),0)
new_catalogue
confirm(3)
set_option(M%(MO%),0)
O_Exit%:
set_option(M%(MO%),0)
print(X%,Y%,S$,W%)
FONT%
S$>W%
Select_Font,Thin_Font%
String_Width,,S$,W%*C_Width%*400,,32,
,,W%,,S%
Y%+=Vi%
X%+W%
400+4*Hi%*S%,Y%
Paint_Chars,,S$,%10101,X%,Y%
4,X%,Y%+C_Height%
sprite(s%,X%,Y%):
("SCHOOSE "+S$(s%)):
237,X%-x%(s%),Y%-y%(s%):
float(s%,X%,Y%)
Window!handle=Score_W%
Window!x1=X%+X%(s%)
X%-=x%(s%)
Window!x0=X%
Window!y1=Y%+Y%(s%)
Y%-=y%(s%)
Window!y0=Y%
Update_Window,,Window+handle
X%+=Window!x0-Window!scx
Y%+=Window!y1-Window!scy
("SCHOOSE "+S$(s%))
3,C_Music:
key%
237,X%,Y%
float_key_sig(X%,Y%+y%(s%))
Get_Rectangle,,Window+handle
float_key_sig(X%,Y%)
I%,A%,C%,W%
KEY_SIG%(1)
C%=SCRIBE%(sclef%)
A%=KEY_SIG%(0)
I%=accidental%+2+A%
W%=x%(I%)+X%(I%):Y%-=y%(I%)
("SCHOOSE "+S$(I%))
I%=0
KEY_SIG%(1)-1
237,X%,Y%+Li%*Key_Y%(C%,A%,I%)
X%+=W%
237,X%,Y%-y%(s%)
start_music
BP%=MUSIC%
BBAR%=0
BP%()=MUSIC%()
BCLEF%()=0
BSIG%(0)=%01100111
BSIG%(1)=%00000010
start_bar
start_bar
GP%=BP%
BAR%=BBAR%
N%()=BP%()
CLEF%()=BCLEF%()
SIG%()=BSIG%()
set_bar
BP%=GP%
BBAR%=BAR%
BP%()=N%()
BCLEF%()=CLEF%()
BSIG%()=SIG%()
back_bar(B%)
GP%>MUSIC%+2
PX%,A%,T%
GP%>MUSIC%+2
back_gate
GP%?1
?GP%:PX%=
back_gate:
B%-=1
set_bar
1GP%=MUSIC%:BCLEF%()=0:BSIG%(0)=&67:BSIG%(1)=2
?GP%=
GP%-=
:A%=?GP%
#T%=%1:
T%=T%<<%1:
Time%,Key%:BSIG%(T%-1)=A%
Clef%:BCLEF%(A%>>6)=A%>>3
Bar%:BAR%+=1
GP%-=
GP%>=BP%
rescore(0)
note_type(C%,T%)
4D N%(C%)?1=N%(C%)?1
T%<<5
note_dots(C%,D%)
4b N%(C%)?1=N%(C%)?1
D%<<3
note_accidental(C%,A%)
N%(C%)?1=N%(C%)?1
note_line(C%,L%)
!?N%(C%)=?N%(C%)
(16+L%)<<3
note_tie(C%,T%)
"?N%(C%)=?N%(C%)
(T%<>0)
note_join(C%,J%)
"?N%(C%)=?N%(C%)
(J%<>0)
note_stem(C%,D%)
#?N%(C%)=?N%(C%)
(D%<>0)
note_clear(C%)
?N%(C%)=0:N%(C%)?1=0
time_sig(N%,B%)
54"?GP%=0:GP%?1=Time%
N%<<1
B%<<5
key_sig(A%,N%)
5R!?GP%=0:GP%?1=Key%
A%<<2
N%<<3
clef(S%,C%)
5p"?GP%=0:GP%?1=Clef%
C%<<3
S%<<6
slur(S%,X%)
"?GP%=0:GP%?1=Slur%
X%<<4
S%<<6
octave(S%,O%)
$?GP%=0:GP%?1=Octave%
O%<<5
S%<<6
?GP%=0:GP%?1=Bar%
insert_gate(W%)
GP%<GATE%
G%=GATE%-W%
-4:G%!W%=!G%:
G%+=3
G%>=GP%:G%?W%=?G%:G%+=
GATE%+=W%
EP%+=W%
?GP%=0:GP%?(W%-1)=0
insert_note(C%)
N%(C%)<FINE%(C%)
N%=FINE%(C%)-2
N%(C%)
-4:N%!2=!N%:
6t N%+=3
N%>=N%(C%):N%?2=?N%:N%+=
FINE%(C%)+=2
?GP%=?GP%
%1<<C%
note_clear(C%)
delete_gate(W%)
GATE%-=W%
GP%<GATE%
G%=GP%
GATE%
4:!G%=G%!W%:
EP%-=W%
delete_note(C%)
FINE%(C%)-=2
N%(C%)<FINE%(C%)
N%=N%(C%)
FINE%(C%)
4:!N%=N%!2:
?GP%=?GP%
(%1<<C%)
allocate_channel(S%)
C%,c%,G%
G%=?GP%
C%=-1:c%=7
c%>=0
%1<<c%:c%+=
c%>=0
S_C%(c%)=S% C%=c%
7x c%+=
arrange_stave(S%)
C%,B%
?GP%
GP%+=2:
GP%>=GATE%
GP%<GATE%
C%=C%
sort_gate
skip_notes(?GP%):GP%+=1
?GP%
B%=C%:C%=
GP%+=2:
GP%>=GATE%
sort_gate
C%,NC%,NN%,G%,g%,pg%,d%,shortest%,Gchanged%
shortest%=255
G%=?GP%
previous_gate(GP%)
preceding_gate(GP%)
NC%=-1
NN%=-1
S_C%(C%)=S%
8^2NC%+=1:n%(NC%)=C%:
%1<<C% NN%+=1:C%(NN%)=C%
%1<<C% d%=N%(C%)?-1>>3
%11100:
d%<shortest% shortest%=d%
shortest%=shortest%
%11100
NC%>0
NN%>=0
=Gchanged%
N%,M%
c%()=-1
same_pitch(n%(M%),C%(N%)) c%(N%)=n%(M%)
c%(N%)<0 c%(N%)=
C%(N%)=c%(N%)
Gchanged%=
in(c%(N%),C%()):
M%>N%
swap_notes(N%,M%)
move_note(N%)
swap_notes(N%,M%)
s%,d%
s%=C%(N%):d%=c%(N%)
C%(N%),C%(M%)
?N%(s%),?N%(d%)
N%(s%)?1,N%(d%)?1
move_note(N%)
s%,d%
s%=C%(N%):d%=c%(N%)
insert_note(d%)
?N%(d%)=?N%(s%)
N%(d%)?1=N%(s%)?1
delete_note(s%)
N%,C%
short%,free%,rest%,any%,tied%
N%=NC%
C%=n%(N%)
in(C%,c%())<0
N%(C%)?-2
tied%=C%+1
%1<<C%
(N%(C%)?-1>>3)=shortest% short%=C%+1
N%(C%)?-2
rest%=C%+1
free%=C%+1
any%=C%+1
short% C%=short%
free% C%=free%
rest% C%=rest%
any% C%=any%
C%=tied%
=C%-1
in(U%,U%())
I%:I%=NN%
U%<>U%(I%):I%-=1:
=I%+(U%<>U%(I%))
same_pitch(c%,C%):
R%,r%:R%=?N%(C%)
&F8:r%=N%(c%)?-2
&F8:=N%(c%)-2>=MUSIC%(c%)
(N%(c%)?-2
4)=4)
%1<<c%
preceding_gate(gp%)
C%,gm%
S_C%(C%)=S% gm%=gm%
%1<<C%
gp%-=1
gp%<MUSIC%+2
gp%?-1=
=?gp%
gp%>MUSIC%+1
gp%?-1<>
previous_gate(gp%)
C%,gm%
S_C%(C%)=S% gm%=gm%
%1<<C%
gp%-=1
gp%>MUSIC%
gp%?-1=
:gp%-=2:
gp%<MUSIC%+2
=?gp%
gp%>MUSIC%+1
conflict(T%,S%,L%)
C%,co%
L%+=16
/co%=?GP%
%1<<C%
S_C%(C%)=S%
(?N%(C%)>>3)=L%
C%+=
=C%-(co%<>0)
set_score(PX%)
PX%(PX%)<Score_Width%
GP%<GATE%
?GP%
set_notes(?GP%):GP%+=1
set_attribute(GP%?1):GP%+=2
assert(GP%<=GATE%,"Does not overrun music end")
EP%=GP%
EX%=PX%
&PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
PTYPE%(PX%+1)=Note%
set_attribute(A%)
PTYPE%(PX%)+
PTYPE%(PX%)
T%:T%=%1:
T%=T%<<1:
<Z&PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
PX%+=1
PTYPE%(PX%)=T%
Time%:PW%(PX%)=20*Hi%
56 T%=accidental%+(A%>>2
%1)+2:SIG%(1)=A%
T%=accidental%+1:
A%,SIG%(1):
A%=8:T%+=1
&PW%(PX%)=(A%>>3
7)*(x%(T%)+X%(T%))
Clef%:PW%(PX%)=x%(clef%+3)+X%(clef%+3)
Bar%:PW%(PX%)=Hi%*4
set_notes(G%)
x0%,x1%,y0%,y1%
C%,P%,R%,s%
C%=-1
%1<<C%
bound_note(!N%(C%))
x0%>P% P%=x0%
x1%>R% R%=x1%
N%(C%)+=2
(2<<C%)>G%
=@)PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%+P%
PX%+=1
PW%(PX%)=R%
PTYPE%(PX%)=Note%
bound_note(L%)
H%,S%,s%
H%=L%>>8
&F8 S%=H%>>5
L%<<3
S%=rest%
H%>>5
x0%=x%(S%)
x1%=X%(S%)
y0%=y%(S%)
y1%=Y%(S%)
s%=accidental%
x0%+=x%(s%)
y%(s%)>y0% y0%=y%(s%)
Y%(s%)>y1% y1%=Y%(s%)
24 s%=dot%+(H%>>3
3):x1%=x%(S%)+X%(s%):
y%(s%)>y0% y0%=y%(s%)
position_staves
Y%,S%
>&8Score_Height%=(PERC%+1+3*(STAVE%+1)+1)*Stave_Height%
>0%Y%=-Score_Height%-Stave_Height%
PERC%
S%=PERC%
-1:Y%+=Stave_Height%:Y_STAVE%(STAVE%+S%)=Y%:
S%=STAVE%
-1:Y%+=3*Stave_Height%:Y_STAVE%(S%)=Y%:
setup_staves
H%,O%
position_staves
>v)H%=S_Height%-2*(B_Height%-Vi%)-24*Vi%
Score_Height%<H% H%=Score_Height%
Window!handle=Score_W%
Close_Window,,Window+handle
Get_Window_State,,Window+handle
Window!y1-Window!y0>H% Window!y0=Window!y1-H%
Window!scx=0:Window!scy=0
Open_Window,,Window+handle
Window!x0=0
Window!y0=-Score_Height%
Window!x1=Score_Width%
Window!y1=0
Set_Extent,Score_W%,Window
update_score(Window!x0,Window!y0,Window!x1,Window!y1)
Window!handle=Score_W%
Update_Window,,Window+handle
draw_staves
Get_Rectangle,,Window+handle
draw_staves
Y%,T%,B%,S%,L%
x%,y%,x1%
c%,t%,b%
y%=Window!y1-Window!scy
x%=Window!x0-Window!scx
1x1%=x%+Score_Width%:
x1%>Clip!x1 x1%=Clip!x1
#c%=Clip!x0:
c%<x%+Hi% c%=x%+Hi%
b%=Clip!y0:t%=Clip!y1
PERC%
S%=STAVE%+1
STAVE%+PERC%
Y%=y%+Y_STAVE%(S%)
b%<=Y%
t%>=Y%
c%,Y%,x1%,Y%
S%=0
STAVE%
@Y%=y%+Y_STAVE%(S%):T%=Y%+Stave_Height%
2:B%=T%-Stave_Height%
b%<=T%
t%>=B%
c%,Y%,x1%,Y%
L%=Li%*2
c%,Y%+L%,x1%,Y%+L%
c%,Y%-L%,x1%,Y%-L%
start_bar
B%=Score_Width%
T%=Clip!x1-x%:
T%<B% B%=T%
T%=Clip!x0-x%:
T%<0 T%=0
draw_score(x%,y%,T%,B%)
draw_score(X%,Y%,A%,B%)
1,C_Music
1,128+C_Stav
start_bar
PX%(PX%+2)<A%
PX%<EX%
skip_gate
PX%(PX%)<B%
GP%<EP%
?GP%
draw_notes(?GP%):GP%+=1
draw_attribute(GP%?1):GP%+=2
skip_gate
?GP%
skip_notes(?GP%):GP%+=1
skip_attribute(GP%?1):GP%+=2
back_gate
GP%?-2 GP%-=1:
back_notes(?GP%)
GP%-=2:
back_attribute(GP%?1)
skip_notes(G%)
PX%+=1
C%:C%=
%1<<C%:N%(C%)+=2:
(2<<C%)>G%
back_notes(G%)
PX%-=1
C%:C%=
%1<<C%:N%(C%)-=2:
(2<<C%)>G%
draw_notes(G%)
C%,x%,y%,s%,l%
PX%+=1
x%=X%+PX%(PX%)
C%=-1
%1<<C%
y%=Y%+Y_STAVE%(S_C%(C%))
?N%(C%)
l%=(?N%(C%)>>3)-16
l%>5
sprite(ledger%+l%
2,x%,y%)
y%+=Li%*l%
s%=N%(C%)?1>>5
?N%(C%)<<3
sprite(s%,x%,y%)
N%(C%)?1
sprite(accidental%
N%(C%)?1
7,x%-x%(s%),y%)
s%=rest%
N%(C%)?1>>5
sprite(s%,x%,y%)
N%(C%)?1
sprite(dot%+(N%(C%)?1>>3
3),x%+x%(s%),y%)
?N%(C%)
sprite(tie%,x%,y%)
N%(C%)+=2
(2<<C%)>G%
skip_attribute(A%)
T%:T%=%1:
T%=T%<<%1:
Time%,Key%:SIG%(T%-1)=A%
Clef%:CLEF%(A%>>6)=A%>>3
Bar%:BAR%+=1
PTYPE%(PX%) PX%+=1
back_attribute(A%)
A%=Bar% BAR%-=1
PTYPE%(PX%+1)+
PTYPE%(PX%+1)
PX%-=1
draw_attribute(A%)
x%,N%
%1<<N%
PTYPE%(PX%)
%1<<N% PX%+=1
x%=X%+PX%(PX%)
N%+1
draw_time_sig(A%),
draw_key_sig(A%),
draw_clef(A%),
draw_slur(A%),
draw_octave(A%),
draw_bar_line(A%)
draw_time_sig(A%)
SIG%(0)=A%
S%,B$,D$,w%
((A%>>1
15)+1)
(%1<<(A%>>5)-1)
w%=x%
B$<2 w%+=PW%(PX%)>>2
D$<2 x%+=PW%(PX%)>>2
FONT%
Select_Font,Roman_Font%
STAVE%+PERC%
Paint_Chars,,B$,%10100,w%,Y%+Y_STAVE%(S%)+Vi%
Paint_Chars,,D$,%10100,x%,Y%+Y_STAVE%(S%)-Li%*4
STAVE%+PERC%
w%,Y%+Y_STAVE%(S%)+Li%*4-Vi%:
x%,Y%+Y_STAVE%(S%)-Vi%:
draw_key_sig(A%)
S%,C%,N%,a%,W%
56 SIG%(1)=A%
A%,SIG%(1):a%=accidental%+1
N%=(A%>>3
N%>=0
A%=A%>>2
a%=accidental%+2+A%
W%=x%(a%)+X%(a%)
x%+=x%(a%)
C%=0
S%=0
STAVE%
sprite(a%,x%,Y%+Y_STAVE%(S%)+Li%*Key_Y%(CLEF%(S%),A%,C%))
x%+=W%
S%=0
STAVE%
sprite(key%,x%,Y%+Y_STAVE%(S%))
draw_clef(A%)
S%=A%>>6
CLEF%(S%)=A%>>3
S%<=STAVE%
sprite(clef%+CLEF%(S%),x%,Y%+Y_STAVE%(S%))
draw_slur(A%)
draw_octave(A%)
draw_bar_line(A%)
BAR%+=1
STAVE%+PERC%
sprite(bar%,x%,Y%+Y_STAVE%(S%))
(STAVE%+1)
x%+Hi%,Y%+Y_STAVE%(STAVE%)+Stave_Height%
8y%=Y_STAVE%(STAVE%-1)-Y_STAVE%(STAVE%)-Stave_Height%
3,0,y%:
0,Hi%,0:
3,0,-y%
put_down
C%,PX%,X%,Y%,S%,s%
GP%=SCRIBE%(sgp%)
7:N%(C%)=SCRIBE%(C%):
PX%=SCRIBE%(posx%)
X%=SCRIBE%(sx%)
Y%=SCRIBE%(sy%)
s%=SCRIBE%(sprite%)
S%=SCRIBE%(stave%)
C%=SCRIBE%(sc%)
release
s%<accidental%
put_note
s%<clef%
put_accidental
s%<dot%
put_clef
s%<bar%
put_dot
s%<time%
put_bar
s%<key%
put_time
s%<tie%
put_key
put_tie
GP%=SCRIBE%(sgp%)
7:N%(C%)=SCRIBE%(C%):
arrange_stave(SCRIBE%(stave%))
CHANGED%=
put_note
L%,E%
L%=SCRIBE%(line%)
X%=PX%(PX%+1)
s%>=rest% L%=-16
E%=GP%=EP%
insert_gate(1)
conflict(Note%,S%,L%)
allocate_channel(S%)
C%>=0
insert_note(C%)
note_type(C%,s%
s%<rest%
note_line(C%,L%):
note_stem(C%,s%
s%=!N%(C%)
set_score(PX%):X%=PX%(PX%+1)
update_note(S%,s%,X%,Y%)
s%=!N%(C%)
delete_note(C%)
?GP%
update_note(S%,s%,X%,Y%)
delete_gate(1)
GP%?-2=0
?GP%=0
GP%<EP%:
delete_gate(2):
rescore(PX%)
X%>PX%(PX%+1)
skip_gate
insert_gate(1)
allocate_channel(S%)
insert_note(C%)
note_type(C%,s%
s%<rest%
note_line(C%,L%):
note_stem(C%,s%
rescore(PX%)
put_tie
?N%(C%)
note_tie(C%,
update_score(X%+24,Y%+12,X%+70,Y%+24)
note_tie(C%,
skip_notes(?GP%):GP%+=1
arrange_stave(S%)
GP%=SCRIBE%(sgp%)
7:N%(I%)=SCRIBE%(I%):
N%(C%)+2>=FINE%(C%)
(?N%(C%)
N%(C%)?2)
note_tie(C%,
update_score(X%+24,Y%+12,X%+70,Y%+24)
put_accidental
A%,a%
a%=N%(C%)?1
A%=s%
A%=a% A%=0
note_accidental(C%,A%)
A%*a%
update_score(X%-34,Y%-24,X%+16,Y%+52)
rescore(PX%)
put_dot
D%,d%
d%=N%(C%)?1>>3
D%=s%
D%=d% D%=0
note_dots(C%,D%)
D%*d%
I*9s%=N%(C%)?1>>5
?N%(C%)<<3
?N%(C%)
s%=s%
rest%
X%+=x%(s%)
update_score(X%+24,Y%-8,X%+50,Y%)
rescore(PX%)
put_clef
c%=s%
GP%=EP%
(GP%?1
%111)<>Clef%
insert_gate(2)
clef(S%,c%)
?GP%=0
(GP%?1
%111)=Clef%
(GP%?1>>6)<>S%
GP%<EP%
skip_gate
GP%<EP%
?GP%=0
(GP%?1
%111)=Clef%
(GP%?1>>6)=S%
(GP%?1>>3
3)<>c%
clef(S%,c%)
delete_gate(2)
insert_gate(2)
clef(S%,c%)
rescore(PX%)
SCORING%=
put_key
GP%=EP%
(GP%?1
%11)<>Key%
insert_gate(2)
key_sig(KEY_SIG%(0),KEY_SIG%(1))
KEY_SIG%(1)>0
(GP%?1>>2
%1)<>KEY_SIG%(0)
(GP%?1>>3)<>KEY_SIG%(1)
key_sig(KEY_SIG%(0),KEY_SIG%(1))
delete_gate(2)
rescore(PX%)
SCORING%=
put_time
GP%=EP%
(GP%?1
%1)<>Time%
insert_gate(2)
time_sig(TIME_SIG%(0),TIME_SIG%(1))
rescore(PX%)
(GP%?1>>1
15)<>TIME_SIG%(0)
(GP%?1>>5)<>TIME_SIG%(1)
time_sig(TIME_SIG%(0),TIME_SIG%(1))
update_score(X%,-Score_Height%,X%+48,0)
delete_gate(2)
rescore(PX%)
SCORING%=
put_bar
(?GP%
GP%?1<>Bar%)
X%>PX%(PX%+1)
GP%<EP%
skip_gate
GP%?-2=0
GP%?-1=Bar%
back_gate
GP%>MUSIC%
GP%<EP%
?GP%=0
GP%?1=Bar%
delete_gate(2)
?GP%=0
GP%<EP%
delete_gate(2)
rescore(PX%)
GP%?-2
insert_gate(2):
rescore(PX%)
rescore(px%)
start_bar
set_score(px%)
update_score(PX%(px%),-Score_Height%,Score_Width%,0)
update_note(S%,N%,X%,Y%)
x0%,x1%,y0%,y1%
bound_note(N%)
4 x1%=X%(tie%):
Y%(tie%)>y1% y1%=Y%(tie%)
(Y%-Y_STAVE%(S%))>Li%*5
x%(dot%)>x0% x0%=x%(dot%)
X%(dot%)>x1% x1%=X%(dot%)
LJ$y1%+=Y%:Y%-=y0%:y0%=Y_STAVE%(S%)
y1%<y0%-Li%*5 y1%=y0%-Li%*5
Y%>y0%+Li%*5 Y%=y0%+Li%*5
update_score(X%-x0%,Y%,X%+x1%,y1%)
attach(s%,V%)
SCRIBE%(sx%)=
SCRIBE%(drawn%)=
s%<rest%
SCRIBE%(sprite%)<rest% s%=s%
SCRIBE%(sprite%)
SCRIBE%(sprite%)=s%
SCRIBE%(valid%)=V%
SCORING%=
release
SCORING%
SCRIBE%(drawn%)
Window:Window=Icon+&200
float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
SCRIBE%(sprite%)<rest%
SCRIBE%(line%)>5
float(ledger%+SCRIBE%(line%)
2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
SCRIBE%(sx%)=
SCRIBE%(drawn%)=
scribe(X%,Y%)
S%,L%,C%
Window!handle=Score_W%
Get_Window_State,,Window+handle
X%-=Window!x0-Window!scx
Y%-=Window!y1-Window!scy
proximate(SCRIBE%(valid%))
X%<>SCRIBE%(sx%)
Y%<>SCRIBE%(sy%)
(SCRIBE%(valid%)
112)=96 A%=
C%>=0 A%=SCRIBE%(valid%)
S%<=STAVE%
?N%(C%)
SCRIBE%(drawn%)
float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
SCRIBE%(sprite%)<rest%
SCRIBE%(line%)>5
float(ledger%+SCRIBE%(line%)
2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
SCRIBE%(drawn%)=
SCRIBE%(sprite%)<rest%
L%>5
float(ledger%+L%
2,X%,Y_STAVE%(S%))
Y%<>SCRIBE%(sy%) SCRIBE%(sprite%)=SCRIBE%(sprite%)
Y%>SCRIBE%(sy%)
SCRIBE%(sx%)=X%
SCRIBE%(sy%)=Y%
SCRIBE%(stave%)=S%
S%<=Max_Stave% SCRIBE%(sclef%)=CLEF%(S%)
SCRIBE%(sclef%)=CLEF%(Max_Stave%)
SCRIBE%(line%)=L%
SCRIBE%(posx%)=PX%
SCRIBE%(sgp%)=GP%
SCRIBE%(sc%)=C%
7:SCRIBE%(C%)=N%(C%):
float(SCRIBE%(sprite%),X%,Y%)
proximate(V%)
d%,D%
px%,x%
start_bar
D%=2*S_Width%
PX%=0
X%-=X%(clef%)>>1
T%=-V%<<1
skip_gate:
PTYPE%(PX%)
GP%=EP%
PTYPE%(PX%)
Bar%
PTYPE%(PX%+1)
GP%<EP%
skip_gate:
GP%=EP%
GP%?1
(X%-PX%(PX%+1))
D%=2*S_Width%
D%>d%
GP%=EP%
d%<D%
X%=PX%(PX%+1)
X%-=X%(2)>>1
skip_gate
PTYPE%(PX%+1)
GP%<EP%:
skip_gate:
(X%-PX%(PX%+1))
D%>d%
GP%=EP%
d%<D%
GP%=EP%
GP%<EP%
X%<PX%(PX%+1)
X%>PX%(EX%)
PTYPE%(PX%) x%=PX%(PX%)+PW%(PX%)-X%(2)
x%=PX%(PX%)
x%=x%+PX%(PX%+1)>>1
128 x%+=Hi%*4:
PTYPE%(PX%)=Bar% x%=PX%(PX%)
x%=PX%(PX%+1)+PX%(PX%+2)>>1
128 x%+=Hi%*4:
PTYPE%(PX%+2)=Bar% x%=PX%(PX%+2)
(PX%(PX%+1)-X%)<
(x%-X%) X%=PX%(PX%+1)
X%=x%
X%=PX%(PX%+1)
PZ C%=-1
?GP%>0
G%,c%
c%=C%
d%=2*S_Height%
G%=?GP%
%1<<C%
D%=Y%-Y_STAVE%(S_C%(C%))
?N%(C%)
&F8 D%=
(D%-Li%*((?N%(C%)>>3)-16))
D%<d% d%=D%:c%=C%
(2<<C%)>G%
C%=c%
S%=S_C%(C%)
?N%(C%)
&F8 L%=(?N%(C%)>>3)-16
MS%=STAVE%:
MS%+=PERC%
S%=-1
D%=2*S_Height%
Q6 d%=D%
Q@ S%+=1
(Y%-Y_STAVE%(S%))
D%>d%
S%=MS%
S%+=d%<D%
S%=STAVE%+1 S%+=Y%>=Y_STAVE%(STAVE%)-Li%*16
S%<=STAVE%
)L%=(Y%-Y_STAVE%(S%))/Li%+16.75:L%-=16
L%>15 L%=15*
Y%=Y_STAVE%(S%)+L%*Li%
savp:n%()=N%():d%=D%:px%=PX%:gp%=GP%:clef%()=CLEF%():sig%()=SIG%():
rstp:N%()=n%():PX%=px%:GP%=gp%:CLEF%()=clef%():SIG%()=sig%():
set_tempo(T%)
Tempo%=T%
Sound_QTempo,Tempo%(T%)*128*4096
play_start
PBAR%=BBAR%+1
PP%=BP%+2
P%()=BP%()
RD PCLEF%(C%)=Clef%(BCLEF%(C%))
play_key_sig(BSIG%(1))
PLAYING%=
Sound_QInit
Rv;Beats%=((BSIG%(0)>>1
&F)+1)*Length%(BSIG%(0)>>3
%11100)
Q%()=Beats%
TIE%=&FF
B2%=&10000
Sound_QBeat,Beats%
Sound_QSchedule,Beats%,Sch%
Sound_QTempo,Tempo%(Tempo%)*128*4096
)C%=Beats%/50*&1000:
C%>&7FFF C%=&7FFF
Sound_QTempo,C%
play_bar
C%,L%,I%,D%,S%,Q%,T%,B%,A%
Q%()=Beats%
B%=PBAR%
Accidental%()=0
B%=PBAR%
PP%<GATE%
?PP%
play_notes(?PP%):PP%+=1
play_attribute(PP%?1):PP%+=2
PP%>=GATE% PLAYING%=
play_notes(G%)
%1<<C%
Q%(S_C%(C%))>Q% Q%=Q%(S_C%(C%))
(2<<C%)>G%
QI%()=&10000:C%=
%1<<C%
=T%=?P%(C%):D%=P%(C%)?1:I%=D%>>3:S%=S_C%(C%):L%=T%>>3:A%=0
S%<=STAVE%
7 Accidental%(S%,L%)=D%
;A%=Accidental%(S%,L%):L%+=PCLEF%(S%):
A%=Key%(L%
%1<<C%
D%=Duration%(Tempo%)?I%:
4 TIE%=TIE%
(%1<<C%):T%=P%(C%)+1:
T%+=2:D%+=Duration%(Tempo%)?(?T%>>3):
T%>FINE%(C%)
D%>254 D%=254
C%+1,Volume%(Volumes%(C%))
&100,Line(L%)+Aoff(A%),D%,Q%
T% TIE%=TIE%
%1<<C%
HP%(C%)+=2:
Length%(I%)<QI%(S%) QI%(S%)=Length%(I%):Q%(S%)=Q%+QI%(S%)
(2<<C%)>G%
play_attribute(A%)
%1<<C%
C%+1
play_time_sig(A%),
play_key_sig(A%),
play_clef(A%),
play_slur(A%),
play_octave(A%),
play_bar_line(A%)
play_time_sig(A%)
TB+A%=((A%>>1
&F)+1)*Length%(A%>>3
%11100)
Sound_QSchedule,Beats%,Sch%
Sound_QBeat,A%
Beats%=A%
play_key_sig(A%)
N%:A%=A%>>2
6:Key%(N%)=Key_Sig%(A%,N%):
play_clef(A%)
PCLEF%(A%>>6)=Clef%(A%>>3
play_slur(A%)
play_octave(A%)
play_bar_line(A%)
PBAR%+=1
count(S$,C$)
C%,I%
C%=-1
U( C%+=1
S$,C$,I%+1)
upper(A%):$String_Space%=$A%:
A%=String_Space%
String_Space%+
$String_Space%-1:
?A%>96 ?A%-=32
:=String_Space%
alphanumeric(C%)
C%>96 C%-=32
C%>47
C%<58
C%>64
C%<91
bit(M%):
I%:I%=
%1<<I%
initialise
initialise_miscellany
initialise_screen
initialise_font(
initialise_sprites
initialise_wimp
initialise_menu
initialise_keyboard
initialise_sound
initialise_options
initialise_music
open_menu(Menu_Root%+1,
initialise_miscellany
EXIT%=
PLAYING%=
String_Space% 256
OS_File=&8
OS_GBPB=&C
OS_FSControl=&29
Sprite$="&.Icons.Music"
OS_FSControl,0,"&.UserTunes"
Host_Dir$="&":
Host$="TotalFudge":
CHANGED%=
FILE%=
initialise_screen
Hi%=2
Vi%=4
S_Width%=1280:S_Height%=1024
"C_Width%=8*Hi%:C_Height%=8*Vi%
"S_Columns%=S_Width%
C_Width%
!S_Rows%=S_Height%
C_Height%
set_colours
set_colours
W0 C_Bkgd=0:
C_Bkgd,&F0,&E0,&90
W: C_Text=1:
C_Text,&80,&30,&10
WD C_Menu=2:
C_Menu,&F0,&C0,&80
WN C_High=3:
C_High,&00,&B0,&00
WX C_Stav=4:
C_Stav,&80,&80,&80
Wb C_Music=5:
C_Music,0, 0, 0
C%=6
C%,0,0,0:
initialise_font(F%)
FONT%=F%
FONT%
Find_Font=&40081
Lose_Font=&40082
String_Width=&40085
Paint_Chars=&40086
Select_Font=&4008A
Find_Font,,"Thin",160,160
Thin_Font%
Find_Font,,"Times.Roman",288,288
Roman_Font%
23,25,3,4,6,7,8,10,11,13
23,25,128,9,&E0,&D0,&A0,0,0,0
initialise_sprites
("SLOAD "+Sprite$)
I%,N%,x%,y%,W%,H%
X4 N%=-1
S$<>""
x%,y%,W%,H%,S$
X\ N%+=1
assert(N%>=0,"Sprite data installed")
S$(N%),x%(N%),y%(N%),X%(N%),Y%(N%)
S$(I%),x%,y%,W%,H%
x%(I%)=x%*Hi%
y%(I%)=y%*Vi%
X%(I%)=(W%-x%)*Hi%
Y%(I%)=(H%-y%)*Vi%
note%=0
rest%=16
accidental%=24
clef%=32
high%=36
dot%=44
ledger%=47
bar%=48
time%=55
key%=56
tie%=57
SL%(N%,1)
SCORING%=
SCRIBE%(18)
Y` sx%=8
Yj sy%=9
drawn%=10
sprite%=11
valid%=12
stave%=13
sclef%=14
line%=15
posx%=16
sgp%=17
sc%=18
B,7,3,26,7,SB,0,2,12,5,Mu,0,2,11,15,Cu,0,2,11,15,Qu,0,2,17,17,SQu,0,2,17,17,DSQu,0,2,17,17,SDSQu,0,2,17,17
B,7,3,26,7,SB,0,2,12,5,Md,0,12,11,15,Cd,0,12,11,15,Qd,0,14,11,17,SQd,0,14,11,17,DSQd,0,14,11,17,SDSQd,0,14,11,17
Rest,-1,-1,8,4,Rest,-1,-2,8,4,Rest,-1,0,8,4,Rest4,-2,5,7,12,Rest8,-1,4,9,8,Rest16,0,8,11,12,Rest32,1,8,13,16,Rest64,2,12,15,20
M,0,2,11,5,Natural,8,6,7,13,Sharp,10,5,9,11,Flat,8,3,7,12,Sharp2,9,2,8,5,Flat2,14,3,13,12,NSharp,17,6,16,13,NFlat,15,6,14,15
Treble,0,16,18,31,Alto,0,8,16,19,Alto,0,4,16,19,Bass,0,7,20,17
Bh,7,3,26,7,SBh,0,2,12,5,Mh,0,2,11,5,Ch,0,2,11,5
ldg5,2,28,15,17,ldg4,2,24,15,13,ldg3,2,20,15,9,ldg2,2,16,15,5,ldg1,2,12,15,1
Dot1,-12,2,3,2,Dot2,-12,2,8,2,Dot3,-12,2,13,2,Bar,-1,8,2,17,C,0,2,11,5
ldg1,2,-12,15,1,ldg2,2,-12,15,5,ldg3,2,-12,15,9,ldg4,2,-12,15,13,ldg5,2,-12,15,17
Time,1,9,25,19,Key,0,13,0,30,Tie,-12,-3,23,3,""
initialise_wimp
enumerate_wimp_SWIs
enumerate_wimp_offsets
Initialise
B_Width%=2*C_Width%+5*Hi%
B_Height%=C_Height%+4*Vi%
*POINTER
Mouse_X%=640:Mouse_Y%=560
PTIME%=0
*FX21,9
redraw_screen
redraw_screen
Force_Redraw,-1,0,0,S_Width%,S_Height%
enumerate_wimp_SWIs
W%:W% = &400C0
Initialise = W%+0
Create_Window = W%+1
Create_Icon = W%+2
Delete_Window = W%+3
Delete_Icon = W%+4
Open_Window = W%+5
Close_Window = W%+6
Poll_Wimp = W%+7
Redraw_Window = W%+8
Update_Window = W%+9
Get_Rectangle = W%+10
Get_Window_State = W%+11
Get_Window_Info = W%+12
Set_Icon_State = W%+13
Get_Icon_Info = W%+14
Get_Pointer_Info = W%+15
Drag_Box = W%+16
Force_Redraw = W%+17
Set_Caret_Position= W%+18
Get_Caret_Position= W%+19
Create_Menu = W%+20
Decode_Menu = W%+21
Which_Icon = W%+22
Set_Extent = W%+23
Set_Pointer_Shape = W%+24
Open_Template = W%+25
Close_Template = W%+26
Load_Template = W%+27
enumerate_wimp_offsets
Wimp_Space &500
Window=Wimp_Space+4
handle=-4
x0=0:y0=4:x1=8:y1=12
scx=16:scy=20
under=24
flags=28:status=30
\X%tFrgd=32:tBkgd=33:Frgd=34:Bkgd=35
sbo=36:sbi=37
tHigh=38
Ex0=40:Ey0=44:Ex1=48:Ey1=52
title_flags=56
work_area_flags=60
sprite_area=64
title=72
icons=84
icon_defs=88
Icon=Wimp_Space+4
iflags=16
Colour=19
idata=20
Mouse=Wimp_Space
buttons=8
window=12
icon=16
old_buttons=20
colour=23
state=4
mask=8
Clip=Window+24
key=20
create_menu_wimp(M%)
P%,W%,S%
N%,N$
X%,I%
P%=MP%(M%)
count($P%,Sep$)-1
$P%-N%*3-2)*C_Width%
menu_OPTION(
menu_name(M%))
S%=C_Width%
I%=2*B_Width%+
N$*C_Width%
I%>W%+N%*S% S%=(I%-W%)
W%+=N%*S%
define_window(0,0,W%+Hi%*2,B_Height%+Vi%*2,&13,
,N$,C_Text,C_Menu,C_Text,C_Bkgd)
Window!icons=N%
Icon:Icon=Window+icon_defs
P%+=4
I%=1
menu_option(P%)
N$*C_Width%+S%
define_icon(X%+Hi%*2,-B_Height%-Vi%,X%+W%,-Vi%,&303D,C_Text,C_Menu,N$)
Icon+=32
X%+=W%
Create_Window,,Window
Menu_W%(M%)
create_list_wimp(L%,T$)
W%,H%,CW%
R%,T%,TH%
LI$,F%
X%,Y%,I%
List_Columns%(L%)<0
(List_Columns%(L%)=
List_Columns%(L%)
List_Items%(L%)/16>List_Columns%(L%) List_Columns%(L%)=List_Items%(L%)
JList_Item$(L%,0)=
List_Item$(L%,0)*List_Columns%(L%)/(1-FONT%*2)," ")
/R%=(List_Items%(L%)-T%)
List_Columns%(L%)+1
CW%=String_Space%:!CW%=0
List_Columns%(L%)
List_Flag%(L%,(I%-1)*R%+T%)
%10 F%=0
F%=I%
#W%+=
max_item_size(L%,F%)
&FFFF
CW%!(I%*4)=W%
X%=2*B_Width%+
T$*C_Width%
T% TH%=
max_item_size(L%,0):H%=TH%
&FFFF:TH%=(TH%>>16)+Vi%:
H%>X% X%=H%
W%=0 W%=1:
X%>W%
List_Columns%(L%)*4
4:CW%!I%=
(CW%!I%*X%/W%+2.5)
(Hi%-1):
:W%=(X%+2)
(Hi%-1)
_2&H%=(
max_item_size(L%,T%)>>16)+Vi%
define_window(0,0,W%,TH%+H%*R%,&13,
,T$,C_Text,C_Menu,C_Music,C_Bkgd)
_F"Window!icons=List_Items%(L%)+1
Icon:Icon=Window+icon_defs
List_Select%(L%)=T%
F%=List_Flag%(L%,0)
LI$=List_Item$(L%,0)
&100 X%=
LI$," "):
X%>0 List_Item$(L%,0)=
LI$,X%-1)
define_icon(0,-TH%,W%,-Vi%,F%,C_Music,C_Bkgd,LI$)
Icon+=32
I%=T%
I%<=List_Items%(L%)
F%=List_Flag%(L%,I%)
LI$=List_Item$(L%,I%)
&100 X%=
LI$," "):
X%>0 List_Item$(L%,I%)=
LI$,X%-1)
&F000 List_Select%(L%)=List_Select%(L%)
%1<<I%
%10 X%=
LI$:LI$=S$(X%):SL%(X%,0)=L%:SL%(X%,1)=I%
X%=(I%-T%)
Y%=TH%+(I%-T%)
R%*H%
define_icon(CW%!X%,-Y%-H%,CW%!(X%+4),-Vi%-Y%,F%,C_Music,C_Bkgd,LI$)
Icon+=32
I%+=1
Create_Window,,Window
List_W%(L%)
max_item_size(L%,C%)
I%,N%,s%,w%,h%,W%,H%,I$:W%=1:H%=1
`^/N%=(List_Items%(L%)-T%)
List_Columns%(L%)+1
`h!I%=N%*(C%-1)+T%:N%=N%*C%-1+T%
N%>List_Items%(L%) N%=List_Items%(L%)
N%=List_Items%(L%)
I%<=N%
I$=List_Item$(L%,I%)
List_Flag%(L%,I%)
w%=x%(s%)+X%(s%)+Hi%*2
h%=y%(s%)+Y%(s%)+Vi%*2
FONT%
List_Flag%(L%,I%)
Select_Font,Roman_Font%
String_Width,,I$,S_Width%*400,,32,
,,w%,,s%
@w%=w%
(List_Flag%(L%,I%)
&F000)=&F000 w%+=2*C_Width%*s%
h%=B_Height%+2*Vi%
I$+1)*C_Width%
h%=B_Height%
w%>W% W%=w%
h%>H% H%=h%
aX I%+=1
al!W%=W%
(Hi%-1):H%=H%
(Vi%-1)
H%<<16
define_window(X%,Y%,W%,H%,F%,B%,T$,tf%,tb%,f%,b%)
$Window=
=Window!x0=X%:Window!y1=Y%:Window!x1=X%+W%:Window!y0=Y%-H%
Window!Ex1=W%:Window!Ey0=-H%
Window!under=-1
Window!flags=F%
%Window?tFrgd=tf%:Window?tBkgd=tb%
!Window?Frgd=f%:Window?Bkgd=b%
'Window!sbo=C_Menu:Window?sbi=C_Text
window?tHigh=C_High
Window!title_flags=&3D
#Window!work_area_flags=B%
&3000
$(Window+title)=T$
define_icon(X0%,Y0%,X1%,Y1%,F%,f%,b%,T$)
3Icon!x0=X0%:Icon!y0=Y0%:Icon!x1=X1%:Icon!y1=Y1%
FONT%
F%=F%
Icon!iflags=F%
&100
X1% X0%
T$," ")
Y0% T$=
T$,Y0%-1)
$X1%=T$
Icon!idata=X1%
Icon!(idata+4)=-1
Icon!(idata+8)=X0%
$(Icon+idata)=T$
&40 Icon?Colour=Roman_Font%
Icon?Colour=f%
b%<<4
update_item(L%,I%,T$)
List_Item$(L%,I%)=T$
update_icon(List_W%(L%),I%,T$)
new_description
update_icon(W%,I%,T$)
Window!handle=W%:!Icon=I%
Get_Icon_Info,,Window+handle
$(Icon!(idata-handle))=T$
Icon!state=0:Icon!mask=0
Set_Icon_State,,Window+handle
icon_text(W%,I%)
Window!handle=W%:!Icon=I%
Get_Icon_Info,,Window+handle
=$(Icon!(idata-handle))
new_icon(W%,I%,T$)
H%,F%
Window!handle=W%:!Icon=I%
Get_Icon_Info,,Window+handle
Delete_Icon,,Window+handle
!Window=W%
$(Icon+idata-handle)=T$
Create_Icon,,Icon
assert(H%=I%,"Icon handle has not changed")
Window!handle=W%:!Icon=I%
Icon!state=0:Icon!mask=0
Set_Icon_State,,Window+handle
initialise_menu
Max_Menu%=63
MP%(Max_Menu%)
Sep$=
Menu_Root%=32
Menu_Description$(Max_Menu%)
Menu_W%(Max_Menu%)
M%(Max_Menu%)
Menu_BASE%(Max_Menu%)
MOP%=0
dF MO%=0
dP Menu_DESCRIPTION%=Menu_Root%
define_menu_hierarchy
Menu_OPTION%(1)
Max_Option%=31
O%(Max_Option%,4)
.Menu%=0:Option%=1:List%=2:Item%=3:State%=4
O$(Max_Option%)
OOP%=0
OO%=0
O$=""
List_Item$(Max_Option%,Max_Option%)
List_Description$(Max_Option%,Max_Option%)
List_Items%(Max_Option%)
List_Columns%(Max_Option%)
List_Flag%(Max_Option%,Max_Option%)
List_W%(Max_Option%)
List_Select%(Max_Option%)
List_STATE%(Max_Option%)
List_N%=0
List_W%(0)=0
List_KEY%=
DESCRIPTION%(2)
DESCRIPTION%(0)=M%(MO%)
DESCRIPTION%(1)=0
DESCRIPTION%(2)=0
O_Initialise%=-1
O_Entry%=-2
O_Exit%=-3
Adj%=64
define_window(0,0,9*C_Width%,4*C_Height%,&83,
,"CONFIRM",C_Text,C_Menu,C_Music,C_High)
Create_Window,,Window
Confirm_W%
CONFIRM%=
define_menu_hierarchy
Menu_MAX%=Menu_Root%-1
define_menu(":Maestro")
describe_menu("MAESTRO:Music scoring facility by Crosbie Fitch (Ashdown Software Ltd)")
define_menu("MAESTRO:Help,Setup,Transcribe,Console,Repertoire,eXit")
describe_menu("HELP:Obtain helpful information about Maestro")
describe_menu("SETUP:Set music volume, stave structure, instruments to use and tempo")
describe_menu("TRANSCRIBE:Enter music into Maestro from manuscript")
describe_menu("CONSOLE:Access control console to play and move about the score")
describe_menu("REPERTOIRE:Music score filing operations")
describe_menu("EXIT:Leave Maestro to whence you came")
define_menu("MAESTRO.HELP:Describe")
describe_menu("DESCRIBE:Briefly describe indicated items")
define_menu("MAESTRO.SETUP:Clear,Volume,Stave,Instrument,Tempo")
describe_menu("CLEAR:Reset music score")
describe_menu("VOLUME:Set loudness of music")
describe_menu("STAVE:Set stave structure for music score")
describe_menu("INSTRUMENT:Set instruments to use for each stave")
describe_menu("TEMPO:Set speed of music")
define_menu("MAESTRO.TRANSCRIBE:Clef,Key,Time,Note,Other")
describe_menu("CLEF:Select a clef")
describe_menu("KEY:Select a key signature")
describe_menu("TIME:Select a time signature")
describe_menu("NOTE:Select notes/rests")
describe_menu("OTHER:Select an accidental or dots for a note, or a bar")
define_menu("MAESTRO.CONSOLE:Begin,Rewind,Stop,Play,Forward,End")
describe_menu("BEGIN:Move to beginning of music score")
describe_menu("REWIND:Move back to previous bar")
describe_menu("STOP:Stop music playing and move to that position in the score")
describe_menu("PLAY:Start music playing from the current position")
describe_menu("FORWARD:Move forward to next bar")
describe_menu("END:Move to end of music score")
define_menu("MAESTRO.REPERTOIRE:Catalogue,Load,Save,Delete")
describe_menu("CATALOGUE:List titles of music in current repertoire")
describe_menu("LOAD:Load a music score from the catalogue")
describe_menu("SAVE:Save the current music score to the catalogue")
describe_menu("DELETE:Delete a music score from the catalogue")
define_menu(M$)
Menu_MAX%+=1
assert(Menu_MAX%<=Max_Menu%,"Sufficient menu indices")
M%,I%
S%,P%
M$,":")
assert(I%,"Colon is present in menu definition")
I%>1 P%=
sub_menu(
M$,I%-1),Menu_MAX%)
assert(
M$>1,"Menu has at least one option")
count(M$,",")+1
assert(S%<11,"Up to 10 menu options")
M$-I%+4+S%*2
MP%(Menu_MAX%)=M%
?M%=P%
M%?1=
M%+=2
M$,I%)
M$,",",2)
M$,I%-1)+Sep$
M%?1=0
M%+=I%+1
create_menu_wimp(Menu_MAX%)
sub_menu(R$,S%)
N%,M%,R%,I%
R$=R$+"."
N%=Menu_Root%
M%=MP%(N%)
R$,".")
hV'I%=
upper(M%),
R$,R%-1)+Sep$,5)-3
R$,R%+1)
assert(I%>0,"Menu root is valid")
M%?I%
R$<>"" N%=M%?I%:
assert(R$="","Menu root is completely defined")
assert(M%?I%=
,"Destination not already defined")
M%?I%=S%
&=N%:Return number of previous menu
describe_menu(D$)
O%,I%
assert(
D$<S_Columns%-1,"Sufficient space to display menu")
D$,":",2)
assert(O%,"Is a menu option")
upper(MP%(Menu_MAX%)),
D$,O%-1)+Sep$,4)-1
assert(I%>0,"Is a valid menu option and has not already been defined")
'MP%(Menu_MAX%)?I%=Menu_DESCRIPTION%
2Menu_Description$(Menu_DESCRIPTION%)=
D$,O%+1)
Menu_DESCRIPTION%+=1
assert(Menu_DESCRIPTION%<=Max_Menu%,"Sufficient description numbers")
menu_option(P%)=
$P%,Sep$)-1)
menu_OPTION(P%)=
upper(P%),
$P%,Sep$)-1)
menu_name(M%)
P%=MP%(?MP%(M%))+1
$P%,Sep$+
M%)+2
define_list(T$,C%)
assert(List_N%>=0,"Previously defined list has been closed")
assert(List_N%<Max_Option%,"Sufficient lists allocated")
List_Item$(0,0)=T$
List_N%=-1-List_N%
List_Items%(-List_N%)=-1
List_Columns%(-List_N%)=C%
=-List_N%
redefine_list(L%)
List_N%=L%-1
Window!handle=List_W%(L%)
Delete_Window,,Window+handle
list_item(D$,F%)
I%,L%:L%=-List_N%
assert(L%>0,"List has been opened")
assert(List_Items%(L%)<Max_Option%,"Sufficient list options allocated")
List_Items%(L%)+=1
D$,":")
,List_Item$(L%,List_Items%(L%))=
D$,I%-1)
j"%List_Flag%(L%,List_Items%(L%))=F%
I% List_Description$(L%,List_Items%(L%))=
D$,I%+1)
end_list(L%)
assert(-List_N%=L%,"Correct list is being closed (& list has been opened)")
assert(List_Items%(L%)>=0,"List contains items")
assert(List_Items%(L%)+1>=List_Columns%(L%),"There are not more columns than items")
create_list_wimp(L%,List_Item$(0,0))
List_N%=L%
initialise_options
M%,I%,P%
M%=Menu_Root%
Menu_MAX%
P%=MP%(M%)
$P%,Sep$+
I%>2
P%+=I%
name_option(M%,P%)
do_option(O_Initialise%)
$P%,Sep$+
initialise_keyboard
*FX229,1
*FX4,1
Imminent_KEY%=0
initialise_sound
enumerate_sound_SWIs
Sound_Configure,8
Sound_Enable
enumerate_sound_SWIs
S0,S1,S2
"S0 = &40140
"S1 = &40180
"S2 = &401C0
Sound_Configure = S0
Sound_Enable = S0+1
Sound_Stereo = S0+2
Sound_Speaker = S0+3
Sound_Volume = S1
Sound_SoundLog = S1+1
Sound_LogScale = S1+2
Sound_InstallVoice = S1+3
Sound_RemoveVoice = S1+4
Sound_AttachVoice = S1+5
Sound_AttachNamedVoice= S1+6
Sound_Tuning = S1+7
Sound_Pitch = S1+8
l Sound_Control = S1+9
l*!Sound_ControlPacked = S1+10
Sound_QInit = S2
l> Sound_QSchedule = S2+1
lH Sound_QRemove = S2+2
lR Sound_QFree = S2+3
l\ Sound_QDispatch = S2+4
lf Sound_QTempo = S2+5
lp Sound_QBeat = S2+6
Sch%=&F000000
initialise_music
N%,C%
=Note%=0:Time%=1:Key%=2:Clef%=4:Slur%=8:Octave%=16:Bar%=32
Ninc%(6),Line(42),Aoff(7),Clef%(3),Key%(6),Key_Sig%(15,6),Length%(31),Duration%(NTempos%),Accidental%(3,31)
6:Ninc%(N%)=
"024579;",N%+1)
ST:ST=&1000/12
,Line(N%)=(1+N%
7<<12)+Ninc%(N%
7)*ST+.49
LAoff(2)=ST:Aoff(3)=-ST:Aoff(4)=ST*2:Aoff(5)=-ST*2:Aoff(6)=ST:Aoff(7)=-ST
1Clef%(0)=11:Clef%(1)=5:Clef%(2)=3:Clef%(3)=-1
(C%>>1)-1
0Key_Sig%(C%,(7+Key_Y%(1,C%
%1,N%))
7)=C%
m88Length%(C%)=(%1<<7-(C%>>2))*(%1111000>>(C%
%1111)
NTempos%
C% 32:Duration%(N%)=C%
mt%D%=75/Tempo%(N%)*Length%(C%)/8+.5
D%>254 D%=254
Duration%(N%)?C%=D%
TIE%=&FF
PLAYING%=
Q%(Max_Stave%+2)
QI%(Max_Stave%+2)
B1%=0:B2%=0
PX%(128),PW%(128),PTYPE%(128)
BP%(7)
MUSIC%(7),FINE%(7)
N%(7),n%(7)
C%(7),c%(7)
BCLEF%(Max_Stave%),CLEF%(Max_Stave%),clef%(Max_Stave%)
BSIG%(1),SIG%(1),sig%(1)
P%(7),PCLEF%(3)
SPACE%=
SPACE%-=&4000
assert(SPACE%>1024,"Sufficient memory available for music storage")
MUSIC% SPACE%+8
FINE%=MUSIC%+SPACE%
GATE%=MUSIC%
nn%MUSIC%(C%)=MUSIC%+(C%+1)*SPACE%/9
FINE%()=MUSIC%()
BBAR%=0
BAR%=0
PBAR%=0
start_music
EP%=GP%
GATE%+=2
Pgap%=X%(2)
PX%(0)=0
PW%(0)=4*Hi%
PTYPE%(0)=Bar%
GP%=MUSIC%
PP%=MUSIC%
P%()=MUSIC%()
set_score(0)
Set_Caret_Position,
OOP%>0
close_window(List_W%(O%(OOP%,List%)))
OOP%-=1
MOP%>0
close_window(Menu_W%(M%(MOP%)))
MOP%-=1
close_window(Description_W%)
close_window(Score_W%)
FONT%
Lose_Font,Thin_Font%
Lose_Font,Roman_Font%
terminate
*FX229
*POINTER 0
4,20,26,31;31
assert(E%,A$):
terminate:
"ASSERTION FAILED: "+A$:=
error
E%,E$
error2:
$+" at line "+
pb&FILE%=FILE%:
FILE%
#FILE%:FILE%=
error_action
INITIALISED%
save_music("ErrorMUSIC")
IFE%=1 ELSEPROCterminate:IFE%<4ANDLENHost$ SYS OS_FSControl,0,Host_Dir$:CHAINHost$ ELSEEND
IFE%=1 ELSEPROCterminate:IFE%<4ANDLENHost$ SYS OS_FSControl,0,Host_Dir$:OSCLI("DeskTop")ELSEEND
INITIALISED%
redraw_screen
error_action
P%,G%
*POINTER 0
28,18,25,62,7
28,20,24,60,8
'" This error has occurred:"''E$
'" Enter 1,2,3 or 4 for next action"'
" 1) Continue program"
" 2) Save music (as ErrorMUSIC) and exit"
" 3) Just exit the program"
" 4) QUIT to system"
'" :?"
"1234",
G%>32
G%<127
G%=13
*POINTER 1
error2
terminate
"Primary error: "E$
'"Secondary error: "
$" at line ";